@inherits RadzenComponent

<RadzenDataGrid Data=@Entries @ref="m_EntriesGrid"
                AllowMultiColumnSorting="true" ShowMultiColumnSortingIndex="true" AllowSorting="true"
                ExpandMode="DataGridExpandMode.Single" RowRender=@RowRender>
    <Template Context="entry">
        @{
            var nestedEntry = (NestedEntry)entry;
        }
        <LaunchParameters NestedPrefix=@nestedEntry.NestedPrefix OnValuesUpdated=OnNestedValuesChanged
                          Parameters=@nestedEntry.Parameters Values=@nestedEntry.Values />
    </Template>
    <Columns>
        <RadzenDataGridColumn TItem="Entry" Title="Name" Property="Name">
            <Template Context="entry">
                <RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Left" Gap="2rem">
                    <span>@(entry.Name)</span>
                    @if (entry is ParameterEntry parameterEntry)
                    {
                        <ParameterHelp Icon="help" HelpText="@(parameterEntry.Definition?.Description)" />
                    }
                </RadzenStack>
            </Template>
        </RadzenDataGridColumn>
        <RadzenDataGridColumn TItem="Entry" Title="Value" Property="Value" Sortable="false">
            @* Make inline fields to edit parameter values *@
            <Template Context="entry">
                @if (entry is ParameterEntry parameterEntry)
                {
                    <LaunchParameterInput Entry="@parameterEntry" OnValueChanged="@OnParameterValueChanged" />
                }
            </Template>
        </RadzenDataGridColumn>
        <RadzenDataGridColumn TItem="Entry" Width="60px" Sortable="false">
            <Template Context="entry">
                <RadzenButton Icon="refresh" Class="data-grid-icon"
                              Click="@(args => ResetToDefault(entry))" ButtonStyle="ButtonStyle.Light"
                              Disabled=@(ShowingDefaultValue(entry)) />
            </Template>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>
